//
//  YJCHeadView.m
//  xiangzhe
//
//  Created by lyt on 16/11/9.
//  Copyright © 2016年 com.dazhebao. All rights reserved.
//

#import "YJCHeadView.h"
#import <Masonry/Masonry.h>

@implementation YJCHeadView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.headPicture = [[UIImageView alloc] init];
        self.headPicture.layer.cornerRadius = 25;
        self.headPicture.layer.masksToBounds = YES;
        [self addSubview:self.headPicture];
        
        self.nameLbale = [[UILabel alloc] init];
        self.nameLbale.textAlignment = NSTextAlignmentCenter;
        self.nameLbale.textColor = [UIColor redColor];
        self.nameLbale.font = [UIFont systemFontOfSize:13];
        [self addSubview:self.nameLbale];
        
        self.rankLbale = [[UILabel alloc] init];
        self.rankLbale.textAlignment = NSTextAlignmentCenter;
        self.rankLbale.textColor = [UIColor whiteColor];
        self.rankLbale.font = [UIFont systemFontOfSize:13];
        [self addSubview:self.rankLbale];
    }
    return self;
    
}

- (void)layoutSubviews{
    
    [super layoutSubviews];
    
    [self.headPicture mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(10);
        make.centerY.equalTo(self);
        make.width.height.mas_equalTo(50);
    }];
    
    [self.nameLbale mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(10);
        make.left.equalTo(self.headPicture.mas_right).offset(5);
    }];
    
    [self.rankLbale mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self).offset(-10);
        make.left.equalTo(self.headPicture.mas_right).offset(5);
    }];
}
@end
